package cn.monkey.chat.server.connect.config;

import cn.monkey.state.bean.RefreshScheduler;
import cn.monkey.state.bean.Refreshable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class RefreshConfig {
    @Bean
    RefreshScheduler refreshScheduler(List<Refreshable> refreshableList) {
        RefreshScheduler refreshScheduler = new RefreshScheduler(4);
        refreshableList.forEach(refreshScheduler::addTask);
        return refreshScheduler;
    }
}
